package com.atguigu.cloud.config;

import com.alibaba.ttl.TransmittableThreadLocal;

public class OrderContent {
    // 使用ThreadLocal存储用户信息，确保线程私有
    private static final TransmittableThreadLocal<String> userContext = new TransmittableThreadLocal<>();

    public static void setUserInfo(String userInfo) {
        userContext.set(userInfo);
    }

    public static String getUserInfo() {
        return userContext.get();
    }

    public static void clearUserInfo() {
        userContext.remove(); // 清理避免内存泄漏
    }
}

